import {
  Body,
  Controller,
  ForbiddenException,
  Get,
  Post,
  Query,
  UseGuards,
} from '@nestjs/common';
import { VideoService } from './video.service';
import { AuthGuard } from '@nestjs/passport';

@Controller('video')
export class VideoController {
  constructor(private readonly videoService: VideoService) {}

  @Get()
  // 查询视频列表
  getVideoList(@Query() params) {
    return this.videoService.getVideoList(params);
  }

  @Post('add')
  @UseGuards(AuthGuard('jwt'))
  // 添加视频
  addVideo(@Body() bodyData) {
    return this.videoService.addVideo(bodyData);
  }

  @Get('detail')
  @UseGuards(AuthGuard('jwt'))
  // 修改视频列表
  getVideoDetail(@Query() params) {
    return this.videoService.getVideoDetail(params);
  }

  @Post('edit')
  @UseGuards(AuthGuard('jwt'))
  // 修改视频列表
  editVideo(@Body() bodyData) {
    return this.videoService.editVideo(bodyData);
  }

  @Get('delete')
  @UseGuards(AuthGuard('jwt'))
  // 删除视频分类
  deleteVideo(@Query() params) {
    return this.videoService.deleteVideo(params);
  }

  @Post('addCategory')
  @UseGuards(AuthGuard('jwt'))
  // 添加视频分类
  addVideoCategory(@Body() bodyData) {
    return this.videoService.addVideoCategory(bodyData);
  }

  @Post('deleteCategory')
  @UseGuards(AuthGuard('jwt'))
  // 删除视频分类
  deleteVideoCategory(@Body() bodyData) {
    return this.videoService.deleteVideoCategory(bodyData);
  }

  @Get('categoryVideoList')
  // 获取分类查询视频
  getCategoryVideoList(@Query() params) {
    return this.videoService.getCategoryVideoList(params);
  }
}
